ġͼκͼ
(һ) غ
    56. putpiel() ص㺯
    57. getpixel()ɫ
() ֱߺͺ
    58. line() ߺ
    59. lineto() ߺ
    60. linerel() Իߺ
    61. setlinestyle() ͺ
    62. getlinesettings() ȡú
    63. setwritemode() ûģʽ
()κ
    64. rectangle() κ
    65. bar() 
    66. bar3d() 麯
    67. drawpoly() κ
() Բߺ
    68. getaspectratio()ȡݺȺ
    69. circle()Բ
    70. arc() Բ
    71. ellipse()Բ
    72. fillellipse() Բ
    73. pieslice() 
    74. sector() Բ
    75. getarccoords()ȡԲ꺯
() 亯
    76. setfillstyle() ͼɫ
    77. setfillpattern() ûͼ
    78. floodfill() 
    79. fillpoly() κ
    80. getfillsettings() ȡú
    81. getfillpattern() ȡûͼú
()ͼ
    82. imagesize() ͼ洢С
    83. getimage() ͼ
    84. putimage() ͼ



ġͼκͼ
   ͼӦóֱߺǷǳõġЩͼֻܿزܻȻûлصĹܣ޷ֱߺߵĺͨģʹعܣͼξͿԱ桢дĻϵԭͼνеӡ
(һ) غ

56. putpixel() ص㺯
ܣ putpixel() ͼģʽĻϻһص㡣
÷ ÷ʽΪvoid putpixel(int x,int y,int color);
˵ x,yΪص꣬colorǸصɫɫҲɫֵ
       ˺Ӧͷļgraphics.h
ֵ 
 Ļ(6,8)һɫص㣺
   putpixel(6,8,RED);

57. getpixel()ɫ
ܣ getpixel()صɫֵ
÷ ú÷ʽΪint getpixel(int x,int y);
˵ x,yΪصꡣ
       ķֵԲӳʵʲɫֵȡڵɫ(μsetpalette())
       ӦͷļΪgraphics.h
ֵ һصɫֵ
 Ļ(8,6)ɫֵcolor
   color=getpixel(8,6);

() ֱߺͺ
   ֱߵĺline(),lineto(),linerel()Щֱʹ꣬ڵǰͼӿڣһӿƣӿڲü־clipΪ棬ôֱ߽ܵӿڱԵضϣclipΪ٣ʹյµĵǰλͼӿڻĻ֮⣬ֱ߽ضϵĻޡ
   ߿ͿɹѡҲԼͼֱֱߺͺ

58. line() ߺ
ܣ line()ʹõǰͼɫͼ߿ڸ仭һֱߡ
÷ ú÷ʽΪvoid line(int startx,int starty,int endx,int endy);
˵ startx,startyΪ,endx,endyΪյ꣬ǰͼ״̬Ļ(һ㲻ɼ)ǰλòı䡣
       ˺ӦͷļΪgraphics.h
ֵ 
 60.linerel()еʵ

59. lineto() ߺ
ܣ lineto()ʹõǰͼɫͼ߿ӵǰλûһֱߵָλá
÷ ˺÷ʽΪvoid lineto(int x,int y);
˵ x,yΪָ꣬ú󣬵ǰλøı䵽ָ(x,y)
       úӦͷļΪgraphics.h
ֵ 
 60.linerel()еʵ

60.linerel() Իߺ
ܣ linerel() ʹõǰͼɫͼ߿ӵǰλÿʼָˮƽʹֱƫƾ뻭һֱߡ
÷ ÷ʽΪvoid linerel(int dx,int dy);
˵ dx,dyֱˮƽƫƾʹֱƫƾ롣
       ú󣬵ǰλñΪƫƾλã磬ԭλ(8,6)úlinerel(10,18)󣬵ǰλΪ(18,24)
ֵ
 ĳΪߺʵ
#include<graphics.h>
void main()
{
   int driver,mode;
   driver=DETECT;
   mode=0;
   initgraph(&driver,&mode,"");
   setcolor(15);
   line(66,66,88,88);
   lineto(100,100);
   linerel(36,64);
   getch();
   restorecrtmode();
}

61. setlinestyle() ͺ
ܣ setlinestyle() Ϊߺõǰͣ͡ͼ߿
÷ setlinestyle() ÷ʽΪvoid setlinestyle(int stly,unsigned pattern,int width);
˵ styleΪȡֵҲӦƱʾ1-10ʾ
       patternԶͼ16λ(bit)ֻ֣еstyle=USERBIT_LINE(ֵΪ1)ʱpatternֵ壬ʹûԶͼͼС1λӦʾˣpattern=0xFFFFʵߣpattern=0x9999ÿؽʾߣҪߣôpatternֵΪ0xFF000xF00FstyleΪUSERBIT_LINEֵʱȻpatternֵãΪṩһֵһȡΪ0
    wigth趨߿ȡֵ1-11иֵ13ʵϣ߿ȡֵΪ2ҲǿԽܵġ
    ÷Ƿsetlinestyle()ôgraphresult()᷵ش룬ҵǰͼЧ
    Turbo Cṩ߿ͷļgraphics.hУ1-101-11ֱг˲ȡֵ뺬塣

1-10  
-----------------------------------------------------
                 ȡ ֵ             
-----------------------------------------------------
   SOLID_LINE          0             ʵ
   DOTTED_LINE         1             
   CNTER_LINE          2             
   DASHED_LINE         3             
   USERBIT_LINE        4             ûԶ
-----------------------------------------------------

1-11 ߿
-----------------------------------------------------------
                        ȡ  ֵ      ˵   
-----------------------------------------------------------
   NORM_WIDTH()           1         һؿ(ȱʡֵ)
   THICK_WIDTH(ӿ)          3         ؿ
-----------------------------------------------------------

ͷļgraphics.h
ֵ 
 ĳʾBCṩͼ
#include<graphics.h>
void main()
{
   int driver,mode;
   driver=DETECT;
   mode=0;
   initgraph(&driver,&mode,"");
   for(i=0;i<4;i++)
   {
      setlinestyle(i,0,1);
      line(i*50,200,i*50+60,200)
   }
   getch();
   restorecrtmode();
}

62. getlinesettings() ȡú
ܣ getlinesettings() õǰõ͡ͼ߿ дlinesettingstypeͽṹ
÷ ÷ʽΪvoid getlinesettings(struct linesettingstype *info);
˵ ˺ִк󣬵ǰ͡ͼ߿ֵװinfoָĽṹӶɴӸýṹлá
   linesettingstypeͽṹ£
   struct linesettingstype {
      int linestyle;
      unsigned upattern;
      int thickness;
   };
   linestyleڴֵͣΪ1-10еĸֵ֮һ
   upatternΪװûԶͼ16λ֣ÿһλһأĸλãôش򿪣رա
   thicknessΪ߿ֵŵıɲμ1-11
   getlinesettings()ӦͷļΪgraphics.h
ֵ صôinfoָĽṹС
 ѵǰ͵дinfoṹ
   struct linesettingstype info;
   getlinesettings(&info);


63.setwritemode() ûģʽ
ܣ setwritemode() ûģʽ
÷ ÷ʽΪ void setwritemode()(int mode);
˵ modeֻȡֵ01modeΪ0»߽ĻԭеͼΣΪȱʡģʽmodeΪ1ô»صԭͼεصȽ(XOR)㣬ȻĻϣʹֻģʽڶλͬһͼʱͼΡsetwritemode()õĻģʽֻӰ캯line(),lineto(),linerel(),recangle()drawpoly()
       setwritemode()Ӧͷļgraphics.h
ֵ 
 ûģʽΪ0
   setwritemode(0);

()κ
   ԶΣɿûֱߺֱṩεĺûܴ󷽱㡣ĶоΡο()κͶο飬ǻѳҲŵһǣȻǶΣǾ()ֱӽܻεĺ

64. rectangle() κ
ܣ rectangle() õǰͼɫͼ߿һϽ½ǵľ(λ򳤷)
÷ ˺÷ʽΪvoid rectangle(int left,int top,int right,int bottom);
˵ left,topϽǵ꣬right,bottom½ǵꡣһϽǵ㲻ڵǰͼӿڣҲü־clipõ(1)ôøúֻͼӿڵľβֲű
      ӦͷļΪgraphics.h
ֵ 
 ĳһЩʵ
#include<graphics.h>
void main()
{
   int driver,mode;
   driver=DETECT;
   mode=0;
   initgrpah(&driver,&mode,"");
   rectangle(80,80,220,200);
   rectangle(140,99,180,300);
   rectangle(6,6,88,88);
   rectangle(168,72,260,360);
   getch();
   restorecrtmode();
}

65. bar() 
ܣ bar()õǰͼɫ(עⲻǸͼɫ)һָϽ½ǵʵĳ()û)
÷ bar()÷ʽΪvoid bar(int left,int top,int right,int bottom);
˵ left,topright,bottomֱΪϽ½꣬Ǻ͵úrectangle()ͬô˺ǰsetfillstyle()setfillpattern()õǰͼɫ
ע˺ֻûбߵΣҪбߵĵΣɵĺbar3d()ȲΪ0ͬʱtopflagҪΪ棬޶ߡ
       ӦͷļΪgraphics.h
ֵ 
 bar3d()еʵ
  
66.bar3d() 麯
ܣ bar3d() ʹõǰͼɫͼ߿ά飬õǰͼ ɫάı档
÷ ˺÷ʽΪvoid bar3d(int left,int top,int right,int bottom,int depth,int topflag);
˵ left,top,right,bottomΪϽ½꣬bar()еһdepthΪȣΪλͨȵķ֮һ㡣ȷͨݺȵΪԼ45(ʱx/yΪ11)
topflag൱һΪ1()ôϷһ棻Ϊ0()άξûж棬ʹάεһ
Ҫʹͼθۣúfloodfill()setfillpattern()ѡͼɫ(μС()亯 )
      bar3d()ӦͷļΪgraphics.h
ֵ 
 ĳһκ飺
#include<graphics.h>
void main()
{
   int driver,mode;
   driver=DETECT;
   mode=0;
   initgraph(&driver,&mode,"");
   setfillstyle(SOLID-FILL,GREEN);
   bar(60,80,220,160);
   setfillstyle(SOLID-FILL,RED);
   bar3d(260,180,360,240,20,1);
   getch();
   restorecrtmode();
}

67. drawpoly() κ
ܣ drawpoly() õǰͼɫͼ߿һɵĶΡ
÷ ˺÷ʽΪvoid drawpoly(int pnumber,int *points);
˵ pnumberΪεĶpointsָ飬Ƕж(x,y)ֵһϵԣxֵǰȻάΪ2ڶ˶жpolypointsʱĿͨsizeof(polypoints)2sizeof(int)õ2ԭÿֵһҪע⣬һnıպͼΣn+1һ(n+1)ڵһꡣ
   drawpoly()ӦͷļΪgrpahics.h
ֵ 
 ĳһͼһͼ
#include<graphics.h>
void main()
{
   int driver,mode;
   static int polypoints1[18]={100,100,110,120,100,130,120,125,140,140,130,120,
   140,110,120,115,100,100};
   static int polypoints2[18]={180,100,210,120,200,130,220,125,240,140,230,120,
   240,110,220,115,220,110};
   driver=DETECT;
   mode=0;
   initgraph(&driver,&mode,"");
   drawpoly(9,polypoints1);
   drawpoly(9,polypoints2);
   getch();
   restorecrtmode();
}

() Բߺ
   һĻϻúԲͼεһĻϿܱѹΪÿһʾ֮ӦʾģʽһݺȡݺָصˮƽС봹ֱСıֵVGAʾػΣݺΪ1.000
   Ϊ˱֤ͼλԤʾĻϣԵݺ;ͬӲʾĻ䡣ݺҪˮƽʹֱıϵɵúgetaspectratio()á

68. getaspectratio()ȡݺȺ
ܣ getaspectratio()xyıϵֵɼĳһضԵݺȡ
÷ ˺÷ʽΪvoid getaspectratio(int xasp,int yasp);
˵ xaspָıŷصxϵyaspָıŷصyϵͨyϵΪ10 000 xϵ10 000(ΪĻظ߱ȿ)
   עݺԶ溯arc(),circle()pieslice()еıӣʹĻԲʾellipse()ԲñȡݺΪӣݺȿͼΣĿУʾͼΡ
   getaspectratio()ӦͷļΪgraphics.h
ֵ xyϵֱxaspyaspָıС
 ĳʾݺȣ
   int xasp,yasp;
   float aspectratio;
   getaspectratio(&xasp,&yasp);
   aspectratio=xasp/yasp;
   printf("aspect ratio: %f",aspectratio);

69. circle()Բ
ܣ circle()ʹõǰͼɫʵ߻һԲ
÷ú÷ʽΪvoid circle(int x,int y,int radius);
˵x,yΪԲ꣬radiusΪԲ뾶ظرʾע⣬circle()Բʱõǰ͡
   ͬellipse()ֻõ뾶radiuscircle()ݺȿԶڣԲȷʾͼ
   ˺ӦͷļΪgraphics.h
ֵ
ͬԲԲڣ100,100
#include<graphics.h>
void main()
{
   int driver,mode;
   driver=DETECT;
   mode=0;
   initgraph(&driver,&mode,"");
   circle(100,100,10);
   circle(100,100,20);
   circle(100,100,30);
   circle(100,100,40);
   circle(100,100,50);
   circle(100,100,60);
   getch();
   restorecrtmode();
}

70. arc() Բ
ܣarc()ʹõǰͼɫʵ߻һԲ
÷÷ʽΪvoid arc(int x,int y,int startangle,int endangle,int radius);
˵x,yΪԲ꣬startangleendangleֱΪʼֹǣradiusΪ뾶ԲͰ뾶ظʼǺֹԶΪλ0λұߣ90λڶ180λߣײ270ȡͬһ3600غϡǶȰʱ뷽ӣҪֹһʼǴָ300Ⱥ90ȷֱΪʼǺֹǣָ300Ⱥ450ȷֱΪʼǺֹǿɻͬĻ360ȿΪ0ȣ360ȷΧarc()ܻԲֻҪȡʼΪ0ȣֹΪ360ȼɡ˺УݺȿԶڡ
   arc()ӦͷļΪgraphics.h
ֵ
ԣ200,200ΪԲģ100Ϊ뾶0ȵ120ȻԲ
#include<graphics.h
void main()
{
   int driver,mode;
   driver=DETECT;
   mode=0;
   initgraph(&drivwer,&mode,"");
   setcolor(WHITE);
   arc(200,200,0,120,100);
   getch();
   restorecrtmode();
}

